package cn.itcast.bos.service.base.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.dao.base.StandardRepository;
import cn.itcast.bos.domain.base.Standard;
import cn.itcast.bos.service.base.StandardService;

/**
 * 取派业务的实现类
 * 
 * @author 王文杰 
 * @version 1.0, 2017-9-2 12:32:41
 */
@Service
@Transactional
public class StandardServiceImpl implements StandardService{

	/** 注入dao */
	@Autowired
	private StandardRepository standardRepository;
	
	/**
	 * 保存的方法
	 */
	@Override
	public void save(Standard standard) {
		
		standardRepository.save(standard);
	}

	/**
	 * 通过条件查询
	 */
	@Override
	public List<Standard> findByName(String name) {
		
		List<Standard> ls = standardRepository.findByName(name);
		
		return ls;
	}

	/**
	 * 查询当前的页面信息  分页查询的
	 */
	@Override
	public Page<Standard> findPageData(Pageable pageable) {
		
		return standardRepository.findAll(pageable);
	}

	/**
	 * 查询所有取派标准的方法
	 */
	@Override
	public List<Standard> findAll() {

		return standardRepository.findAll();
	}

}
